﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<head>
<title>查看/编辑问题类型</title>
<style>
.form-control {
	width: 70%;
}
</style>
<script type="text/javascript">
	$(function() {
		editAble(true);
		
		$("#cancelBtn").click(function() {
			window.location.href="${bashPath}/problemType/toProblemTypePage";
		});
		
		$("#editData").click(function() {
			var problemTypeOperatorId = ${problemType.operatorId};
			var currentOperatorId = ${operator.id};
			if (problemTypeOperatorId==currentOperatorId) {
				editAble(false);
			} else {
				alert("当前问题类型你只有查看权限");
			}
		});
		
		$("#submitBtn").click(function() {
			$.post("${basePath}/problemType/updateProblemType", $("#updateProblemTypeForm").serialize(), function(data) {
				if (data.success) {
					window.location.href="${bashPath}/problemType/toProblemTypePage";
				} else {
					alert(data.msg)
				}
			});
		});
	});
	
	function editAble(flag) {
		$("#problemTypeName").attr("readonly", flag);
		$("#problemTypeDesc").attr("readonly", flag);
	}
</script>
</head>
<form id="updateProblemTypeForm" name="updateProblemTypeForm" enctype="multipart/form-data" class="form-horizontal" role="form">
	<input value="${problemType.id}" name="id" id="id" type="hidden"></input>
	<input value="${problemType.operatorId}" name="operatorId" id="operatorId" type="hidden"></input>
	<div id="update" class="container">
		<div class="row clearfix">
			<div class="col-md-12 column" style="padding-top:10px">
				<div class="form-group">
					<label for="problemTypeName" class="col-sm-2 control-label">问题类型名称：</label>
					<div class="col-sm-10">
						<input style="width:20%;padding-left: 3px; padding-right: 5px; padding-top: 4px;" class="form-control" id="problemTypeName" name="problemTypeName" value="${problemType.problemTypeName }" type="text" />
					</div>
				</div>
				<div class="form-group">
					<label for="problemTypeDesc" class="col-sm-2 control-label">问题类型说明：</label>
					<div class="col-md-10 column">
						<textarea id="problemTypeDesc" name="problemTypeDesc" style="width: 70%; height: 100px;">${problemType.problemTypeDesc }</textarea>
					</div>
				</div>
			</div>
			<div class="col-md-8 column">
				<div align="center" class="form-group">
					<button id="submitBtn" type="button" class="btn btn-default">确定</button>
					<button id="cancelBtn" type="button" class="btn btn-default">取消</button>
					<button id="editData" type="button" class="btn btn-default">编辑数据</button>
				</div>
			</div>
		</div>
	</div>
</form>